package com.aodesoft.base;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;
import static com.aodesoft.power.Itp.IN;
import static com.aodesoft.power.Itp.EX;
import com.opensymphony.xwork2.ActionSupport;

@SuppressWarnings("unused")
public  class BaseAction extends ActionSupport implements ServletContextAware,
	ServletResponseAware, ServletRequestAware, SessionAware {

    private static final long serialVersionUID = 1L;

    protected ServletContext servletContext;

    protected HttpServletRequest request;

    protected HttpServletResponse response;
    
    protected HttpSession httpSession;
    
    protected Map<String, Object> session;
    
    
    public String viewpath; //该属性会在struts.xml中用到

    public void setServletContext(ServletContext context) {
	this.servletContext = context;
    }
    
    public void setServletResponse(HttpServletResponse response) {
	this.response = response;
    }

    public void setServletRequest(HttpServletRequest request) {
    	this.request = request;
		this.httpSession = request.getSession();
    }
    public void setSession(Map<String, Object> session) {
    	this.session = session;
    }

    public String view(String vpath){
        viewpath = vpath;
        return "view";
    }

    public String redirect(String vpath){
        viewpath = vpath;
        return "redirect";
    }


    public String getViewpath() {
        return viewpath;
    }
}
